<?php
########################################################
##  Reverse Proxy WMS Service
########################################################

// Set error level
error_reporting(E_ERROR);

// Capture URL Arguments
$args = $_SERVER['QUERY_STRING'];

// create a new curl resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://maps.co.mecklenburg.nc.us/geoserver/wms?".$args); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// grab URL, and return output
$output = curl_exec($ch);

// Manipulate the output if desired
//$output = str_replace('Google', 'PHPit', $output);

// Send the header based on the response from the server and set expire time to 12 hours (3600 * 12)
header('Content-type: '.curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
//header("Expires: " . gmdate("D, d M Y H:i:s", time() + 86400) . " GMT");

// Send the curl output
echo $output;

// close curl resource, and free up system resources
curl_close($ch);

?>